package com.kolaxy.chat;

import java.util.Scanner;

public class TestChat {

    public static void main(String[] args) throws Exception {
        final ChatClient chatClient = new ChatClient();

        new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        chatClient.read();
                        Thread.sleep(1000L);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();


        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNextLine()) {
            String s = scanner.nextLine();
            chatClient.sendMsg(s);
            Thread.sleep(1000L);
        }
    }
}
